package com.fltry.work;

import android.app.Activity;
import android.content.Intent;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.fltry.commom.ARouterActivity;
import com.fltry.commom.Bean;
import com.fltry.commom.GlobalValues;

import java.io.Serializable;

@Route(path = GlobalValues.ACTIVITY_URL_WORK)
public class WorkActivity extends ARouterActivity {

    TextView tv;
    @Autowired
    String strValue;
    @Autowired
    int intValue;
    @Autowired
    boolean booleanValue;
    Bean bean;


    @Override
    protected void initView() {
        setContentView(R.layout.activity_work);
        tv = findViewById(R.id.work_tv);
        bean = (Bean) getIntent().getSerializableExtra("bean");
        findViewById(R.id.work_btn).setOnClickListener(v -> {
            Intent intent = new Intent();
            intent.putExtra("result", "接收到workActivity返回值");
            setResult(Activity.RESULT_OK, intent);
            finish();
        });

        String textStr = "strValue：" + strValue +
                "\nintValue：" + intValue +
                "\nbooleanValue：" + booleanValue +
                "\nbean：" + (bean != null ? bean.getTitle() : "bean为空");
        tv.setText(textStr);
    }
}
